//--------------------------------------------------------------//
// Mathias Schmidt Sepia
//--------------------------------------------------------------//

//--------------------------------------------------------------//
// Pass 0
//--------------------------------------------------------------//

//--------------------------------------------------------------//
// Base Texture
//--------------------------------------------------------------//
uniform extern texture imageTexture;
sampler2D baseMap = sampler_state
{
   Texture = <imageTexture>;
};
float fvalue1; 
float fvalue2; 

struct PS_INPUT 
{
   float2 Texcoord : TEXCOORD0;   
};

float4 Textured_Pass_0_Pixel_Shader_ps_main( PS_INPUT Input ) : COLOR0
{
   float4 pre_value = float4(0.0f,0.0f,0.0f,0.0f);
   float4 past_value = float4(0.0f,0.0f,0.0f,0.0f);
   pre_value = tex2D( baseMap, Input.Texcoord );
     
   float Y_value = 0.299f * pre_value.x + 0.587f * pre_value.y + 0.114f * pre_value.z;
   float I_value = 0.596f * pre_value.x - 0.274f * pre_value.y - 0.322f * pre_value.z;
   float Q_value = 0.212f * pre_value.x - 0.523f * pre_value.y + 0.311f * pre_value.z;
   
   I_value = fvalue2;//0.51f;
   Q_value = fvalue1;//0.0f;
   
   
   pre_value.x = 1.0f * Y_value + 0.956f * I_value + 0.621f * Q_value;
   pre_value.y = 1.0f * Y_value - 0.272f * I_value - 0.647f * Q_value;
   pre_value.z = 1.0f * Y_value - 1.105f * I_value + 1.702f * Q_value;
   
   past_value += pre_value;
   
   return past_value;
}

//--------------------------------------------------------------//
// Technique Section for Sepia
//--------------------------------------------------------------//
technique GrayScale
{
   pass Pass_0
   {
      PixelShader = compile ps_2_0 Textured_Pass_0_Pixel_Shader_ps_main();
   }
}

